import { UserListRequest, UserStatus } from '@libs/common/protos/user/user';
import { Timestamp } from '@libs/common/protos/google/protobuf/timestamp';
import { ApiProperty } from '@nestjs/swagger';
import { IsInstance, IsInt, IsOptional, IsString, Min } from 'class-validator';

export class UserListDto implements UserListRequest{
  @ApiProperty({ description: '页码',example:1,required:true })
  @IsInt({ message: '页码必须是整数' })
  @Min(1, { message: '页码必须大于等于1' })
  page: number;
  @ApiProperty({ description: '每页数量',example:10,required:true })
  @IsInt({ message: '每页数量必须是整数' })
  @Min(1, { message: '每页数量必须大于等于1' })
  pageSize: number;
  @ApiProperty({ description: '用户名模糊查询',example:'张三' })
  @IsOptional()
  usernameLike: string;
  @ApiProperty({ description: '用户状态',example:UserStatus.USER_STATUS_UNKNOWN })
  @IsOptional()
  status: UserStatus;
  @ApiProperty({ description: '创建时间开始' })
  @IsOptional()
  createTimeStart: Timestamp | undefined;
  @ApiProperty({ description: '创建时间结束' })
  @IsOptional()
  createTimeEnd: Timestamp | undefined;
}
